<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Commerce Office</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- CSS -->
    <link href="<?php echo base_url();?>assets/css/bootstrap.css" rel="stylesheet">
    <style type="text/css">

      /* Sticky footer styles
      -------------------------------------------------- */
      html,
      body {
        height: 100%;
        /* The html and body elements cannot have any padding or margin. */
      }

      /* Wrapper for page content to push down footer */
      #wrap {
        min-height: 100%;
        height: auto !important;
        height: 100%;
        /* Negative indent footer by it's height */
        margin: 0 auto -60px;
      }

      /* Set the fixed height of the footer here */
      #push,
      #footer {
        height: 60px;
      }
      #footer {
        background-color: #f5f5f5;
      }

      /* Lastly, apply responsive CSS fixes as necessary */
      @media (max-width: 767px) {
        #footer {
          margin-left: -20px;
          margin-right: -20px;
          padding-left: 20px;
          padding-right: 20px;
        }
      }

      /* Custom page CSS
      -------------------------------------------------- */
      /* Not required for template or sticky footer method. */

      #wrap > .container {
        padding-top: 60px;
      }
      .container .credit {
        margin: 20px 0;
      }
      code {
        font-size: 80%;
      }
      
      .form-signin {
        max-width: 400px;
        padding: 19px 29px 29px;
        margin: 50px auto;
        background-color: #fff;
        border: 1px solid #e5e5e5;
        -webkit-border-radius: 5px;
           -moz-border-radius: 5px;
                border-radius: 5px;
        -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
           -moz-box-shadow: 0 1px 2px rgba(0,0,0,.05);
                box-shadow: 0 1px 2px rgba(0,0,0,.05);
      }
      .form-signin .form-signin-heading,
      .form-signin .checkbox {
        margin-bottom: 10px;
      }
      .form-signin input[type="text"],
      .form-signin input[type="password"] {
        height: auto;
        padding: 7px 9px;
      }
      hr{
		margin: 15px 0;
		border: 0;
		border-top: 1px solid #EEE;
		border-bottom: 1px solid #FFF;
		}

    </style>
    <link href="<?php echo base_url();?>assets/css/bootstrap-responsive.css" rel="stylesheet">

    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="<?php echo base_url();?>assets/js/html5shiv.js"></script>
    <![endif]-->

    <!-- Fav and touch icons -->
    <link rel="shortcut icon" href="<?php echo base_url();?>assets/image/icon.png">
    
  </head>

  <body onload="document.form.login.focus();">


    <!-- Part 1: Wrap all page content here -->
    <div id="wrap">

      <!-- Fixed navbar -->
      <div class="navbar navbar-inverse navbar-fixed-top">
        <div class="navbar-inner">
          <div class="container">
            <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
            </button>
            <a class="brand" href="#">Commerce Office</a>
            <div class="nav-collapse collapse">
              <!--<ul class="nav navbar-form pull-right">
                <li><a href="#">Home</a></li>
                <li><a href="<?php echo site_url('auth/register');?>">Register</a></li>             
              </ul>-->
            </div><!--/.nav-collapse -->
          </div>
        </div>
      </div>

      <!-- Begin page content -->
      <div class="container">
		
		<div class="form-signin">
		<?php
		$login = array(
			'name'	=> 'login',
			'id'	=> 'login',
			'value' => set_value('login'),
			'maxlength'	=> 80,
			'size'	=> 30,
			'class' => 'input-block-level',
			'placeholder' => 'Username or Email address'
		);
		if ($login_by_username AND $login_by_email) {
			$login_label = 'Email or login';
		} else if ($login_by_username) {
			$login_label = 'Login';
		} else {
			$login_label = 'Email';
		}
		$password = array(
			'name'	=> 'password',
			'id'	=> 'password',
			'size'	=> 30,
			'class' => 'input-block-level',
			'placeholder' => 'Password',
		);
		$remember = array(
			'name'	=> 'remember',
			'id'	=> 'remember',
			'value'	=> 1,
			'checked'	=> set_value('remember'),
			'style' => 'margin:0;padding:0',
		);
		$captcha = array(
			'name'	=> 'captcha',
			'id'	=> 'captcha',
			'maxlength'	=> 8,
		);
		?>
		
		
		<?php echo form_open($this->uri->uri_string(), 'name="form" id="login-form"'); ?>
        
			<h2 class="form-signin-heading">Please sign in</h2>
			<?php echo form_input($login); ?>
			<span style="color:#E91510"><?php echo form_error($login['name']); ?><?php echo isset($errors[$login['name']])?$errors[$login['name']]:''; ?></span>
			<hr>
			
			<?php echo form_password($password); ?>
			<span style="color:#E91510"><?php echo form_error($password['name']); ?><?php echo isset($errors[$password['name']])?$errors[$password['name']]:''; ?></span>
			
			<hr>
			<p>
			<label for="remember"><?php echo form_checkbox($remember); ?> Remember me</label>
			</p>
			
			<?php echo form_submit('submit', 'Sign in','class="btn btn-primary" type="submit"'); ?>
			
			<span style="float:right"> 
				<?php echo anchor('/auth/forgot_password/', 'Forgot password ?'); ?>
			</span>
			
		<?php echo form_close(); ?>
		</div>
      </div>

      <div id="push"></div>
    </div>

    <div id="footer">
      <div class="container">
        <p class="muted credit">Copyright &copy; 2013 <a href="#">Commerce</a></p>
      </div>
    </div>



    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="<?php echo base_url();?>assets/js/jquery.1.9.1.js"></script>
    <script src="<?php echo base_url();?>assets/js/bootstrap-transition.js"></script>
    <script src="<?php echo base_url();?>assets/js/bootstrap-alert.js"></script>
    <script src="<?php echo base_url();?>assets/js/bootstrap-modal.js"></script>
    <script src="<?php echo base_url();?>assets/js/bootstrap-dropdown.js"></script>
    <script src="<?php echo base_url();?>assets/js/bootstrap-scrollspy.js"></script>
    <script src="<?php echo base_url();?>assets/js/bootstrap-tab.js"></script>
    <script src="<?php echo base_url();?>assets/js/bootstrap-tooltip.js"></script>
    <script src="<?php echo base_url();?>assets/js/bootstrap-popover.js"></script>
    <script src="<?php echo base_url();?>assets/js/bootstrap-button.js"></script>
    <script src="<?php echo base_url();?>assets/js/bootstrap-collapse.js"></script>
    <script src="<?php echo base_url();?>assets/js/bootstrap-typeahead.js"></script>
    
    <script src="<?php echo base_url();?>assets/js/jquery.validate.js"></script>
    
    <script type="text/javascript">
		$("#login-form").validate({
                rules: {
                    login: "required",                    
                    password: "required",  
                },
                messages: {
                    name: "Username or Email is required!",
                    password: "Password is required",
                },
                submitHandler: function(form) {					
                    form.submit();
                }
            });
            
            <?php if (isset($errors[$login['name']])){ ?>
				$("#login").removeClass('valid');
				$("#login").addClass('error');
			<?php }?>
            
            <?php if (isset($errors[$password['name']])){ ?>
				$("#password").removeClass('valid');
				$("#password").addClass('error');				
			<?php }?>
	</script>

  </body>
</html>
